import requests

url = "http://www.renren.com/972994466/profile"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36"
}
cookies = {
"Cookie": "anonymid=k3n4bdx2-2ouv0m; depovince=ZGQT; _r01_=1; jebe_key=abd6c815-2716-4cd4-8ca7-0255d9a9812a%7Cf53dd9fc31dca2eb967cebd763efdf34%7C1575213616445%7C1%7C1575213680820; jebe_key=abd6c815-2716-4cd4-8ca7-0255d9a9812a%7Cf53dd9fc31dca2eb967cebd763efdf34%7C1575213616445%7C1%7C1575213680825; ln_uact=15729346258; ln_hurl=http://head.xiaonei.com/photos/0/0/men_main.gif; JSESSIONID=abcrk-jYV07bXgoGwAe7w; ick_login=b46a1369-61fb-4f7c-a8fc-a5d4eb4c331a; first_login_flag=1; wp_fold=0; jebecookies=f578d5cc-ed70-4492-805f-1c4729f644b3|||||; _de=441F637FD42BDC2C1F90E79AB0D2FDF8; p=fb77a6b7d07408ab565c61446c0034146; t=6fffb2965b04d697458451c4bb5ac3ef6; societyguester=6fffb2965b04d697458451c4bb5ac3ef6; id=972994466; xnsid=3b8ac2ba; ver=7.0; loginfrom=null"
}
response = requests.get(url, headers=headers, cookies=cookies)
# print(response.content.decode("utf-8"))#打印字节码数据

import requests

# 1.为爬虫创建session机制
s = requests.session()
# 2.登录网址
login_url = "http://www.renren.com/ajaxLogin/login"
data = {
"email": "",
"password": "",
}
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36",
}
response = s.post(login_url, headers=headers, data=data)  # 参数cookies自动保存在session
# print(response.text)
url = "http://www.renren.com/972994466/profile"
response = s.get(url, headers=headers)
# print(response.text)


import requests
url = "https://www.baidu.com"
proxies = {
    "https": "https://114.239.146.116:808"
}
response = requests.get(url, proxies=proxies)
print(response.content.decode("utf-8"))
